package afss.freesky.data.conn;

import java.sql.DriverManager;
import java.util.Properties;

/**
 * 
 * @author Jacky@AFSS, 2012
 *
 */
public class DBSql2k8IPv6Bean extends DBConnBean {
	/**
	 *
	 */
	private static final long serialVersionUID = -4451777563654845691L;
	public static boolean IS_IPV6_ENABLED = true;
	public static String DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
	public static String URL = "jdbc:sqlserver://;serverName=fe80::bdb1:7b00:9788:358e%11:1433;user=sab;password=sab;DatabaseName=FS_SAB";
	public static String USER = "sab";
	public static String PASSWORD = "sab";

	public DBSql2k8IPv6Bean() {
		super();
	}

	/*
	 * @see afss.freesky.common.db.IDBConn#getConnection()
	 */

	public void getConnection() {
		try {
			Class.forName(DRIVER).newInstance();
			if (IS_IPV6_ENABLED)
				System.setProperty("java.net.preferIPv6Addresses", "true");
			else
				System.setProperty("java.net.preferIPv6Addresses", "false");

			Properties pro = new Properties();
			pro.setProperty("serverName", "fe80::bdb1:7b00:9788:358e%11");
			pro.setProperty("user", "sab");
			pro.setProperty("password", "sab");
			conn = DriverManager.getConnection("jdbc:sqlserver://;", pro);
		} catch (java.lang.ClassNotFoundException ce) {
			logger.error("Get Connection error:", ce);
		} catch (java.sql.SQLException se) {
			logger.error("Get Connection error:", se);
		} catch (Exception e) {
			logger.error("Get Connection error:", e);
		}
	}
}
